home *** CD-ROM | disk | FTP | other *** search
-
- #include "../CGVPMacro.csi"
-
- MainInput { uniform sampler2D bumpMap : texunit0,
- uniform sampler2D phongMap : texunit2,
- uniform float4 Specular }
- DeclarationsScript
- {
- OUT_T0_T1_T2_T3
- FOUT
- }
- CoreScript
- {
- // load the bump normal
- float4 bumpNormal = 2*(tex2D(bumpMap, IN.Tex0.xy)-0.5);
- // compute texCoord(NdotH, 0) and use it to look up NdotH^power in the power texture
- // This should create a texm3x2tex instruction for ps_1_1 equivalent to the ps_1_1
- // builtin tex2D_dp3x2 (which is not supported in any other profile):
- // float4 NdotL_NdotH = tex2D_dp3x2(specPowMap, IN.Tex2, bumpNormal);
- float2 texCoord = float2(
- dot(IN.Tex1.xyz, bumpNormal.xyz),
- dot(IN.Tex2.xyz, bumpNormal.xyz));
- float4 NdotL_NdotH = tex2D(phongMap, texCoord);
-
- // compute the specular color
- float3 spec = (Specular.xyz * NdotL_NdotH.w) * 2;
-
- // finally add them all together
- OUT.Color.xyz = spec.xyz;
- OUT.Color.w = 1;
- }
-
-